import { IParam } from '../../common';
import { IEvent } from '../../modules';
import { IGridAbility } from '../ability';
import { ICtrlActionResult } from '../data-action';
import { IGridStore } from '../store';
import { IMDCtrlController } from './i-md-ctrl-controller';

/**
 * 表格部件控制器接口
 *
 * @export
 * @interface IGridController
 * @extends {ICtrlController}
 */
export interface IGridController<S extends IGridStore, A extends IGridAbility>
	extends IMDCtrlController<S, A> {
	/**
	 * 处理子组件行为
	 *
	 * @param {IEvent<string>} actionParam 行为参数
	 * @memberof IGridController
	 */
	handleComponentAction(actionParam: IEvent<string>, index: number): void;

	/**
	 * 新建行
	 *
	 * @return {*}  {Promise<ICtrlActionResult>}
	 * @memberof IGridController
	 */
	newRow(data?: IParam[]): Promise<ICtrlActionResult>;

	/**
	 * 删除数据
	 *
	 * @param {IParam[]} datas
	 * @return {*}  {Promise<ICtrlActionResult>}
	 * @memberof IGridController
	 */
	remove(datas: IParam[]): Promise<ICtrlActionResult>;

	/**
	 * 切换行编辑装填
	 *
	 * @memberof IGridController
	 */
	toggleRowEdit(): void;

    /**
     * 处理列过滤值改变
     *
     * @param {IParam} filter
     * @memberof IGridController
     */
    handleFilterChange(filter: IParam): void;

	/**
	 * 获取表格数据源
	 *
	 * @return {*}  {IParam[]}
	 * @memberof IGridController
	 */
	getDataSource(): IParam[];
}
